<?php

namespace app\webapi\vms\validate\cms;

use app\webapi\common\BaseValidate;

/**
 * @单页验证类
 */
class SingleValidate extends BaseValidate
{
    //验证规则
    protected $rule = [
        'id' => 'require|number',
        'channel_id' => 'require|number',
        'name' => 'length:0,64',
        'subtitle' => 'length:0,64',
        'content' => 'length:0,2048',
        'company_name' => 'length:0,128',
        'company_address' => 'length:0,128',
        'longitude' => 'length:0,128',
        'latitude' => 'length:0,128',
        'telephone' => 'length:0,128',
        'mobile' => 'mobile',
        'email' => 'email',
        'office_hours' => 'length:0,128',
        'wx_office_qrcode' => 'length:0,255',
    ];

    //验证消息
    protected $message = [
        'page_no.require' => '页码必填',
        'page_no.number' => '页码参数必须是整数类型',
        'page_size.require' => '每页显示条目数必填',
        'page_size.number' => '每页显示条目数必须是整数类型',
        'category_id.number' => '分类id必须是整数类型',
        'id.require' => '文章id必填',
        'id.number' => '文章id必须是整数类型',
        'ids.require' => '文章id集合必填',
        'ids.length' => '文章id集合限制0-64个字符',
        'keyword.length' => '搜索关键字限制0-32个字符',
        'title.length' => '标题限制0-32个字符',
        'summary.length' => '副标题限制0-32个字符',
        'cover.url' => '封面图片地址不是有效的url地址',
        'content.length' => '内容限制2048个字符',
        'channel_id.require' => '栏目id必填',
        'channel_id.number' => '栏目id必须是整数类型',
        'is_show_index.in' => '是否首页显示可选值为0,1',
        'is_show_list.in' => '是否列表显示可选值为0,1',
        'release_time.date' => '发布日期必须是日期格式',
        'tags.length' => '标签长度最大限制128个字符',
        'release_type.in' => '发布类型可选值为1,3',
        'reading_volume.number' => '阅读量必须是整型数字',
        'seo_title.length' => 'seo标题长度为0-32个字符',
        'seo_keywords.length' => 'seo关键字长度为0-128个字符',
        'seo_desc.length' => 'seo描述长度为0-2048个字符',
    ];

    //验证场景
    protected $scene = [
        'getHonoraryQualifications' => ['channel_id'],
        'setHonoraryQualifications' => ['channel_id', 'name', 'subtitle'],
        'getContactUs' => ['channel_id'],
        'setContactUs' => ['channel_id', 'name', 'subtitle', 'company_name', 'company_address', 'longitude',
            'latitude', 'telephone', 'mobile', 'email', 'office_hours', 'wx_office_qrcode'],
    ];

}